if exists (select 1
            from  sysobjects
           where  id = object_id('bd_kq_ot_settle')
            and   type = 'U')
   drop table bd_kq_ot_settle
go

/*==============================================================*/
/* Table: bd_kq_ot_settle                                       */
/*==============================================================*/
create table bd_kq_ot_settle (
   id                   bigint               identity,
   user_serial          bigint               not null,
   user_name            varchar(200)         null,
   user_dept            bigint               not null default 0,
   settle_year          int                  not null default 0,
   settle_month         int                  not null default 0,
   prev_month_ordinary  int                  not null default 0,
   prev_month_weekend   int                  not null default 0,
   prev_month_owe       int                  not null default 0,
   cur_month_ordinary   int                  not null default 0,
   cur_month_weekend    int                  not null default 0,
   cur_month_statutory  int                  not null default 0,
   cur_month_fangban    int                  not null default 0,
   cur_month_rest       int                  not null default 0,
   cur_month_leave      int                  not null default 0,
   cur_month_owe        int                  not null default 0,
   cur_month_deduction_ordinary int                  not null default 0,
   cur_month_deduction_weekend int                  not null default 0,
   prev_month_deduction_ordinary int                  not null default 0,
   prev_month_deduction_weekend int                  not null default 0,
   cur_month_settle_ordinary int                  not null default 0,
   cur_month_settle_weekend int                  not null default 0,
   cur_month_save_ordinary int                  not null default 0,
   cur_month_save_weekend int                  not null default 0,
   prev_month_settle_ordinary int                  not null default 0,
   prev_month_settle_weekend int                  not null default 0,
   prev_month_save_ordinary int                  not null default 0,
   prev_month_save_weekend int                  not null default 0,
   cur_month_result_ordinary int                  not null default 0,
   cur_month_result_weekend int                  not null default 0,
   prev_month_result_owe int                  not null default 0,
   settle_type          int                  not null default 0,
   settle_value         decimal(8,1)         not null default 0,
   save_value           decimal(8,1)         not null default 0,
   prev_settle_value    decimal(8,1)         not null default 0,
   prev_save_value      decimal(8,1)         not null default 0,
   operateId            bigint               not null,
   operateTime          datetime             not null,
   cur_month_result_leave int                  not null default 0,
   constraint PK_BD_KQ_OT_SETTLE primary key (user_serial, user_dept, settle_year, settle_month)
)
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'id')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'id'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   'id',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'id'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'user_serial')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'user_serial'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '员工ID',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'user_serial'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'user_name')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'user_name'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '员工姓名',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'user_name'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'user_dept')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'user_dept'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '部门ID',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'user_dept'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'settle_year')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'settle_year'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '年份',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'settle_year'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'settle_month')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'settle_month'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '月份',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'settle_month'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'prev_month_ordinary')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'prev_month_ordinary'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '截止上月未结算-平时加班',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'prev_month_ordinary'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'prev_month_weekend')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'prev_month_weekend'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '截止上月未结算-双休加班',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'prev_month_weekend'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'prev_month_owe')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'prev_month_owe'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '截止上月未结算-欠工',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'prev_month_owe'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'cur_month_ordinary')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_ordinary'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '当月实际-平时加班',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_ordinary'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'cur_month_weekend')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_weekend'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '当月实际-双休加班',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_weekend'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'cur_month_statutory')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_statutory'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '当月实际-节假日加班',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_statutory'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'cur_month_fangban')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_fangban'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '当月实际-放班',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_fangban'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'cur_month_rest')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_rest'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '当月实际-调休',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_rest'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'cur_month_leave')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_leave'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '当月实际-事假',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_leave'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'cur_month_owe')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_owe'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '当月实际-欠工',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_owe'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'cur_month_deduction_ordinary')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_deduction_ordinary'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '当月抵扣后-平时加班',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_deduction_ordinary'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'cur_month_deduction_weekend')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_deduction_weekend'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '当月抵扣后-双休加班',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_deduction_weekend'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'prev_month_deduction_ordinary')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'prev_month_deduction_ordinary'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '截止上月抵扣后结余-平时加班',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'prev_month_deduction_ordinary'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'prev_month_deduction_weekend')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'prev_month_deduction_weekend'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '截止上月抵扣后结余-双休加班',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'prev_month_deduction_weekend'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'cur_month_settle_ordinary')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_settle_ordinary'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '结算当月加班工资-平时加班',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_settle_ordinary'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'cur_month_settle_weekend')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_settle_weekend'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '结算当月加班工资-双休加班',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_settle_weekend'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'cur_month_save_ordinary')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_save_ordinary'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '转存工-平时加班',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_save_ordinary'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'cur_month_save_weekend')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_save_weekend'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '转存工-双休加班',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_save_weekend'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'prev_month_settle_ordinary')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'prev_month_settle_ordinary'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '结算截止上月加班工资-平时加班',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'prev_month_settle_ordinary'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'prev_month_settle_weekend')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'prev_month_settle_weekend'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '结算截止上月加班工资-双休加班',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'prev_month_settle_weekend'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'prev_month_save_ordinary')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'prev_month_save_ordinary'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '截止上月结余-平时加班',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'prev_month_save_ordinary'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'prev_month_save_weekend')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'prev_month_save_weekend'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '截止上月结余-双休加班',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'prev_month_save_weekend'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'cur_month_result_ordinary')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_result_ordinary'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '截止本月结余-平时加班',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_result_ordinary'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'cur_month_result_weekend')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_result_weekend'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '截止本月结余-双休加班',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_result_weekend'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'prev_month_result_owe')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'prev_month_result_owe'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '截止本月结余-欠工',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'prev_month_result_owe'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'settle_type')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'settle_type'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   ' 结算类型 0:值结算  1：百分比结算
   2：数值结算',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'settle_type'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'settle_value')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'settle_value'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '当月-结算比例/值',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'settle_value'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'save_value')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'save_value'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '当月-存工比例/值',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'save_value'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'prev_settle_value')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'prev_settle_value'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '截止上月-结算比例/值',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'prev_settle_value'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'prev_save_value')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'prev_save_value'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '截止上月-存工比例/值',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'prev_save_value'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'operateId')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'operateId'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '操作人',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'operateId'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'operateTime')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'operateTime'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '操作时间',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'operateTime'
go

if exists(select 1 from sys.extended_properties p where
      p.major_id = object_id('bd_kq_ot_settle')
  and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'cur_month_result_leave')
)
begin
   declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_dropextendedproperty 'MS_Description',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_result_leave'

end


select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
   '请假抵扣后剩余',
   'user', @CurrentUser, 'table', 'bd_kq_ot_settle', 'column', 'cur_month_result_leave'
go
